<template>
  <div>
    <el-card>
      <VCategory :isShow="isShow !== 1" />
    </el-card>
    <el-card class="spu-main">
      <SpuList v-if="isShow === 1" @setState="updateShowElement" />
      <SkuFrom v-if="isShow === 2"></SkuFrom>
      <SpuFrom v-if="isShow === 3" :spuId="spuId" />
    </el-card>
  </div>
</template>

<script lang="ts" setup>
import SpuList from './SpuList/index.vue'
import SpuFrom from './SpuFrom/index.vue'
import SkuFrom from './SkuFrom/index.vue'
import { ref } from 'vue'
import type { IResSpu } from '@/types/spu'

const isShow = ref<number>(1)
const spuId = ref<number | string>('')
const updateShowElement = (value: number, row?: IResSpu) => {
  isShow.value = value
  row?.id ? (spuId.value = row?.id) : (spuId.value = '')
}

ref
</script>

<script lang="ts">
export default {
  name: 'VSpu'
}
</script>

<style lang="scss" scoped>
.spu-main {
  margin-top: 20px;
}
</style>
